package com.css.cloudlearn.productornacos.sentinel;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 郭辉
 * @className TODO
 * @description TODO
 * @date 2022/11/21 19:51
 * @company 海康威视
 * @since 1.0.0
 */
@RestController
@RequestMapping("/sentinel")
public class SentinelController {

    @RequestMapping("/testSentinel")
//    @SentinelResource(value = "test_sentinel",fallback = "testSentinelFallback")
    @SentinelResource(value = "test_sentinel",blockHandlerClass = BlockHandler.class,blockHandler = "testSentinelExceptionHanler")
    public Object testSentinel(@RequestParam("id") long id){
        return "testSentinel - pong";
    }

    public String testSentinelFallback(){
        return "testSentinel - fallback - pong";
    }
}
